import { type Ref, ref } from 'vue'

export default function useTableRowSelection<T = any>() {
  const selectedRows = ref<T[]>([]) as Ref<T[]>

  function onRowSelectionChange(selected: T[]) {
    selectedRows.value = selected
  }

  return { selectedRows, onRowSelectionChange }
}
